import Vue from 'vue';
import emitter from 'element-ui/src/mixins/emitter';
import { Tools, Notice } from '@/utils/tools';
import api from '@/api/apiConfig';
const map = {
    _confirm: Notice.confirm,
    _message: Notice.message,
    _notify: Notice.notify,
    _prompt: Notice.prompt,
    _toBoolean: Tools.toBoolean,
    _fIndex: Tools.fIndex,
    _debounce: Tools.debounce,
    _formatTime: Tools.formatTime,
    _post: api.post,
    _get: api.get,
    _delete: api.deletes,
    _put: api.put,
    _isFloat: function (value) {
        // 编写正则表达式
        const reg = /^\d+(?=\.?\d+$|$)/;
        return value !== '' ? reg.test(value) : false;
    }
};
Object.keys(map).forEach((key) => {
    Vue.prototype[key] = map[key];
});
Vue.mixin(emitter);
